$(function () {
    // Let the library know where WebSocketMain.swf is:
    WEB_SOCKET_SWF_LOCATION = "WebSocketMain.swf";
    return;
// Write your code in the same way as for native WebSocket:
    $.when(getLoginUser())
        .then(function (res) {
            initSocket(res);
        })
        .fail(function (error) {
            console.log(error);
        });
    /**
     * socket 初始化
     * @param res
     */
    function initSocket(res) {
        if ($('iframe').length) {  // 顶部页面进行初始化
            var domain = getDomain();
            // var ws = new WebSocket("ws://" + domain.split(':')[0]+ ":8080/websocket?ID=" + res.id);
            // ws.onopen = function () {
                // ws.send("Hello");  // Sends a message.
            // };
            // ws.onmessage = function (e) {
                // Receives a message.
                // notice(e.data);
            // };
            // ws.onclose = function () {
            //     console.log("closed");
            // };
        }
    }
});